package com.ynding.spring.physical.redis.meta;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * redis 通用使用
 * @author ynding
 * @version 2022/04/20
 */
@SpringBootApplication
public class PhysicalRedisMetaApplication {

    public static void main(String[] args) {
        SpringApplication.run(PhysicalRedisMetaApplication.class, args);
    }

    /**
     * spring 线程池配置
     * @return
     */
    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        ThreadPoolTaskScheduler executor = new ThreadPoolTaskScheduler();
        executor.setPoolSize(20);
        executor.setThreadNamePrefix("taskExecutor-");
        executor.setWaitForTasksToCompleteOnShutdown(true);
        executor.setAwaitTerminationSeconds(60);
        return executor;
    }

}
